home *** CD-ROM | disk | FTP | other *** search
/ 321 GAMES / 321GAMES.iso / advent / zoom / pizza / zoom.dxr / 00002_Pref File Handlers.ls < prev    next >
Encoding:
Text File  |  1996-03-28  |  2.1 KB  |  95 lines

  1. global gUtilObj, gFileObj, gItemDelimiter, gWindowsPath, gSystemPath, gPrefName, gPrefPath, gFileText, gExeName, gStartTicks
  2.  
  3. on checkPrefFile fileName, exeName, introLabel, menuLabel
  4.   if objectp(gUtilObj) then
  5.     gUtilObj(mdispose)
  6.   end if
  7.   set gPrefName to fileName
  8.   set gExeName to exeName
  9.   createPrefPath()
  10.   readPrefFile()
  11.   deletePrefFile()
  12.   testVar(introLabel, menuLabel)
  13. end
  14.  
  15. on externalButtonAction
  16.   writePrefFile()
  17.   if objectp(gFileObj) then
  18.     gFileObj(mdispose)
  19.   end if
  20.   open(the pathName & "zoombini.exe", "zoom.exe")
  21.   quit()
  22. end
  23.  
  24. on createPrefPath
  25.   if objectp(gUtilObj) then
  26.     gUtilObj(mdispose)
  27.   end if
  28.   if the machineType = 256 then
  29.     set gUtilObj to MovUtils(mnew)
  30.     set gItemDelimiter to "\"
  31.     set gWindowsPath to gUtilObj(mGetWindowsPath)
  32.     set gPrefPath to gWindowsPath & gItemDelimiter & gPrefName
  33.   else
  34.     openXLib("MovieUtilities.xobj")
  35.     set gUtilObj to MovieUtilities(mnew)
  36.     set gItemDelimiter to ":"
  37.     set gSystemPath to gUtilObj(mGetSystemPath)
  38.     set gPrefPath to gSystemPath & "Preferences" & gItemDelimiter & gPrefName
  39.   end if
  40.   put "gPrefPath = " & gPrefPath
  41. end
  42.  
  43. on writePrefFile
  44.   if objectp(gFileObj) then
  45.     gFileObj(mdispose)
  46.   end if
  47.   set gFileObj to FileIO(mnew, "write", gPrefPath)
  48.   set todayDate to the date
  49.   gFileObj(mWriteString, todayDate)
  50.   gFileObj(mdispose)
  51. end
  52.  
  53. on readPrefFile
  54.   if objectp(gFileObj) then
  55.     gFileObj(mdispose)
  56.   end if
  57.   set gFileObj to FileIO(mnew, "read", gPrefPath)
  58.   if objectp(gFileObj) then
  59.     set gFileText to gFileObj(mReadFile)
  60.     put the result
  61.   else
  62.     put "No pref file exists."
  63.     set gFileText to EMPTY
  64.   end if
  65.   if objectp(gFileObj) then
  66.     gFileObj(mdispose)
  67.   end if
  68.   put "gFileText = " & gFileText
  69. end
  70.  
  71. on deletePrefFile
  72.   if objectp(gFileObj) then
  73.     gFileObj(mdispose)
  74.   end if
  75.   set gFileObj to FileIO(mnew, "read", gPrefPath)
  76.   if objectp(gFileObj) then
  77.     gFileObj(mDelete)
  78.   end if
  79.   put the result
  80. end
  81.  
  82. on testVar introLabel, menuLabel
  83.   if gFileText = EMPTY then
  84.     go(introLabel)
  85.   else
  86.     go(menuLabel)
  87.   end if
  88. end
  89.  
  90. on simpleTimer howLong
  91.   if (the ticks - gStartTicks) <= (howLong * 60) then
  92.     play frame the frame
  93.   end if
  94. end
  95.